/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.components;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart;
import org.eclipse.emf.eef.runtime.context.PropertiesEditingContext;
import org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent;
import org.eclipse.emf.eef.runtime.providers.PropertiesEditingProvider;
import org.omg.deployment.InstanceDeploymentDescription;
import org.omg.deployment.parts.ConfigPropertiesPropertiesEditionPart;
import org.omg.deployment.parts.DeployedResourcePropertiesEditionPart;
import org.omg.deployment.parts.DeploymentViewsRepository;
import org.omg.deployment.parts.InstanceDeploymentDescriptionPropertiesEditionPart;


/**
 * @author Toby McClean; Zeligsoft (2009) Limited
 * @generated
 */
public class InstanceDeploymentDescriptionPropertiesEditionComponent extends ComposedPropertiesEditionComponent {

	/**
   * The Base part
   * @generated
   */
  private InstanceDeploymentDescriptionPropertiesEditionPart basePart;
  /**
   * The InstanceDeploymentDescriptionBasePropertiesEditionComponent sub component
   * @generated
   */
  protected InstanceDeploymentDescriptionBasePropertiesEditionComponent instanceDeploymentDescriptionBasePropertiesEditionComponent;
  /**
   * The ConfigProperties part
   * @generated
   */
  private ConfigPropertiesPropertiesEditionPart configPropertiesPart;
  /**
   * The InstanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent sub component
   * @generated
   */
  protected InstanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent instanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent;
  /**
   * The DeployedResource part
   * @generated
   */
  private DeployedResourcePropertiesEditionPart deployedResourcePart;
  /**
   * The InstanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent sub component
   * @generated
   */
  protected InstanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent instanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent;
  /**
	 * Default constructor
	 * @generated
	 */
	public InstanceDeploymentDescriptionPropertiesEditionComponent(PropertiesEditingContext editingContext, EObject instanceDeploymentDescription, String editing_mode) {
    super(editingContext, editing_mode);
    if (instanceDeploymentDescription instanceof InstanceDeploymentDescription) {
      PropertiesEditingProvider provider = null;
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(instanceDeploymentDescription, PropertiesEditingProvider.class);
      instanceDeploymentDescriptionBasePropertiesEditionComponent = (InstanceDeploymentDescriptionBasePropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, InstanceDeploymentDescriptionBasePropertiesEditionComponent.BASE_PART, InstanceDeploymentDescriptionBasePropertiesEditionComponent.class);
      addSubComponent(instanceDeploymentDescriptionBasePropertiesEditionComponent);
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(instanceDeploymentDescription, PropertiesEditingProvider.class);
      instanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent = (InstanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, InstanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent.CONFIGPROPERTIES_PART, InstanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent.class);
      addSubComponent(instanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent);
      provider = (PropertiesEditingProvider)editingContext.getAdapterFactory().adapt(instanceDeploymentDescription, PropertiesEditingProvider.class);
      instanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent = (InstanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent)provider.getPropertiesEditingComponent(editingContext, editing_mode, InstanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent.DEPLOYEDRESOURCE_PART, InstanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent.class);
      addSubComponent(instanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent);
    }
  }

	/**
   * {@inheritDoc}
   * 
   * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
   *      getPropertiesEditionPart(int, java.lang.String)
   * @generated
   */
  public IPropertiesEditionPart getPropertiesEditionPart(int kind, String key) {
    if (InstanceDeploymentDescriptionBasePropertiesEditionComponent.BASE_PART.equals(key)) {
      basePart = (InstanceDeploymentDescriptionPropertiesEditionPart)instanceDeploymentDescriptionBasePropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)basePart;
    }
    if (InstanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent.CONFIGPROPERTIES_PART.equals(key)) {
      configPropertiesPart = (ConfigPropertiesPropertiesEditionPart)instanceDeploymentDescriptionConfigPropertiesPropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)configPropertiesPart;
    }
    if (InstanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent.DEPLOYEDRESOURCE_PART.equals(key)) {
      deployedResourcePart = (DeployedResourcePropertiesEditionPart)instanceDeploymentDescriptionDeployedResourcePropertiesEditionComponent.getPropertiesEditionPart(kind, key);
      return (IPropertiesEditionPart)deployedResourcePart;
    }
    return super.getPropertiesEditionPart(kind, key);
  }

  /**
   * {@inheritDoc}
   * 
   * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
   *      setPropertiesEditionPart(java.lang.Object, int,
   *      org.eclipse.emf.eef.runtime.api.parts.IPropertiesEditionPart)
   * @generated
   */
  public void setPropertiesEditionPart(java.lang.Object key, int kind, IPropertiesEditionPart propertiesEditionPart) {
    if (DeploymentViewsRepository.InstanceDeploymentDescription.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      basePart = (InstanceDeploymentDescriptionPropertiesEditionPart)propertiesEditionPart;
    }
    if (DeploymentViewsRepository.ConfigProperties.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      configPropertiesPart = (ConfigPropertiesPropertiesEditionPart)propertiesEditionPart;
    }
    if (DeploymentViewsRepository.DeployedResource.class == key) {
      super.setPropertiesEditionPart(key, kind, propertiesEditionPart);
      deployedResourcePart = (DeployedResourcePropertiesEditionPart)propertiesEditionPart;
    }
  }

  /**
   * {@inheritDoc}
   * 
   * @see org.eclipse.emf.eef.runtime.impl.components.ComposedPropertiesEditionComponent#
   *      initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
   *      org.eclipse.emf.ecore.resource.ResourceSet)
   * @generated
   */
  public void initPart(java.lang.Object key, int kind, EObject element, ResourceSet allResource) {
    if (key == DeploymentViewsRepository.InstanceDeploymentDescription.class) {
      super.initPart(key, kind, element, allResource);
    }
    if (key == DeploymentViewsRepository.ConfigProperties.class) {
      super.initPart(key, kind, element, allResource);
    }
    if (key == DeploymentViewsRepository.DeployedResource.class) {
      super.initPart(key, kind, element, allResource);
    }
  }

}
